package com.xiaoshuidi.cloud.module.iot.service;

import com.xiaoshuidi.cloud.module.iot.controller.admin.doorlock.vo.OperateThirdDeviceRequestModel;
import com.xiaoshuidi.cloud.module.iot.controller.admin.doorlock.vo.OperateThirdDeviceResponseModel;
import com.xiaoshuidi.cloud.module.iot.dal.model.pass.OperateThirdPassRequestModel;
import com.xiaoshuidi.cloud.module.iot.dal.model.pass.OperateThirdPassResponseModel;
import com.xiaoshuidi.cloud.module.iot.dal.model.pass.PassInfoResModel;
import com.xiaoshuidi.cloud.module.iot.dal.pojo.TbDeviceDo;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author Sky
 * create 2019/08/26
 * email sky.li@ixiaoshuidi.com
 **/
public abstract class AbstractThirdInstanceService implements ThirdInstanceService {
    public ThreadPoolExecutor singleCoreThreadExecutor = new ThreadPoolExecutor(1, Runtime.getRuntime().availableProcessors() * 4,
            2, TimeUnit.MINUTES, new ArrayBlockingQueue<>(16), new ThreadFactory() {
        AtomicInteger threadNum = new AtomicInteger(0);
        @Override
        public Thread newThread(Runnable r) {
            Thread asyncThread = new Thread(r);
            asyncThread.setName("城投宽庭异步任务 - " + threadNum.incrementAndGet());
            return asyncThread;
        }
    }, new ThreadPoolExecutor.CallerRunsPolicy());
    /**
     * 设置电表单价（单个设备）
     *
     * @param operateThirdDeviceRequestModel
     * @return
     */
    @Override
    public OperateThirdDeviceResponseModel setAmmeterPrice(OperateThirdDeviceRequestModel operateThirdDeviceRequestModel) {
        OperateThirdDeviceResponseModel operateThirdDeviceResponseModel = new OperateThirdDeviceResponseModel();
        operateThirdDeviceResponseModel.setOperateResult(true);
        return operateThirdDeviceResponseModel;
    }

    /**
     * 设置水表单价（单个设备）
     *
     * @param operateThirdDeviceRequestModel
     * @return
     */
    @Override
    public OperateThirdDeviceResponseModel setWaterMeterPrice(OperateThirdDeviceRequestModel operateThirdDeviceRequestModel) {
        OperateThirdDeviceResponseModel operateThirdDeviceResponseModel = new OperateThirdDeviceResponseModel();
        operateThirdDeviceResponseModel.setOperateResult(true);
        return operateThirdDeviceResponseModel;
    }


    /**
     * 设置水表付费模式（单个设备）
     *
     * @param operateThirdDeviceRequestModel
     * @return
     */
    @Override
    public OperateThirdDeviceResponseModel setWaterMeterPayment(OperateThirdDeviceRequestModel operateThirdDeviceRequestModel) {
        OperateThirdDeviceResponseModel operateThirdDeviceResponseModel = new OperateThirdDeviceResponseModel();
        operateThirdDeviceResponseModel.setOperateResult(true);
        return operateThirdDeviceResponseModel;
    }

    /**
     * 设置电表付费模式（单个设备）
     *
     * @param operateThirdDeviceRequestModel
     * @return
     */
    @Override
    public OperateThirdDeviceResponseModel setAmmeterPayment(OperateThirdDeviceRequestModel operateThirdDeviceRequestModel) {
        OperateThirdDeviceResponseModel operateThirdDeviceResponseModel = new OperateThirdDeviceResponseModel();
        operateThirdDeviceResponseModel.setOperateResult(true);
        return operateThirdDeviceResponseModel;
    }

    /**
     * 充值电表电费
     *
     * @param operateThirdDeviceRequestModel
     * @return
     */
    @Override
    public OperateThirdDeviceResponseModel chargeAmmeterFee(OperateThirdDeviceRequestModel operateThirdDeviceRequestModel) {
        OperateThirdDeviceResponseModel operateThirdDeviceResponseModel = new OperateThirdDeviceResponseModel();
        operateThirdDeviceResponseModel.setOperateResult(true);
        return operateThirdDeviceResponseModel;
    }

    /**
     * 电表入住
     *
     * @param operateThirdDeviceRequestModel
     * @return
     */
    @Override
    public OperateThirdDeviceResponseModel stayAmmeter(OperateThirdDeviceRequestModel operateThirdDeviceRequestModel) {
        OperateThirdDeviceResponseModel operateThirdDeviceResponseModel = new OperateThirdDeviceResponseModel();
        operateThirdDeviceResponseModel.setOperateResult(true);
        return operateThirdDeviceResponseModel;
    }

    /**
     * 电表退租
     *
     * @param operateThirdDeviceRequestModel
     * @return
     */
    @Override
    public OperateThirdDeviceResponseModel recedeAmmeter(OperateThirdDeviceRequestModel operateThirdDeviceRequestModel) {
        OperateThirdDeviceResponseModel operateThirdDeviceResponseModel = new OperateThirdDeviceResponseModel();
        operateThirdDeviceResponseModel.setOperateResult(true);
        return operateThirdDeviceResponseModel;
    }

    @Override
    public OperateThirdPassResponseModel addPassMember(OperateThirdPassRequestModel operateThirdPassRequestModel) {
        return null;
    }

    @Override
    public OperateThirdPassResponseModel updatePassMember(OperateThirdPassRequestModel operateThirdPassRequestModel) {
        return null;
    }

    @Override
    public OperateThirdPassResponseModel deletePassMember(OperateThirdPassRequestModel operateThirdPassRequestModel) {
        return null;
    }


    @Override
    public OperateThirdPassResponseModel getPassMemberGroups(OperateThirdPassRequestModel operateThirdPassRequestModel) {
        return null;
    }

    /**
     * 刷新门禁详情
     *
     * @param tbDeviceDo
     * @param operateThirdPassRequestModel
     * @return
     */
    @Override
    public PassInfoResModel refreshPassInfo(TbDeviceDo tbDeviceDo, OperateThirdPassRequestModel operateThirdPassRequestModel) {
        return null;
    }


    @Override
    public OperateThirdDeviceResponseModel chargeWatermeterFee(OperateThirdDeviceRequestModel operateThirdDeviceRequestModel) {
        return null;
    }

    @Override
    public OperateThirdDeviceResponseModel stayWatermeter(OperateThirdDeviceRequestModel operateThirdDeviceRequestModel) {
        return null;
    }

    @Override
    public OperateThirdDeviceResponseModel recedeWatermeter(OperateThirdDeviceRequestModel operateThirdDeviceRequestModel) {
        return null;
    }

    /**
     * 远程开锁
     *
     * @param operateThirdDeviceRequestModel
     * @return
     */
    @Override
    public OperateThirdDeviceResponseModel remoteOpenDoorlock(OperateThirdDeviceRequestModel operateThirdDeviceRequestModel) throws Exception {
        return null;
    }
}
